<cpanel include="../../config.php">

<?

/***************************************************************************
 *                                 autoresponders_manage.php
 *                            -------------------
 *   Begin                : Thursday, April 16, 2005
 *   Copyright            : (C) 2005 Point and Code
 *   Domain               : http://www.pointandcode.com/
 *   Email                : support@pointandcode.com
 *   Version              : 1.0.0
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

$html_root_path = '../../';
include $root_path.'common.php';
$page_title = $lang['autoresponders'];
include $root_path.'page_header.php';




$big_wadge_of_stuff = <<<EOFpacman
<cpanel Email="listautoresponders()">
EOFpacman;

//
// Split up into lines...
//
$array_of_autoresponders_with_junk = array();
$array_of_autoresponders_with_junk = explode('</tr>', $big_wadge_of_stuff);

$array_of_autoresponders = array();
$i=0;

foreach($array_of_autoresponders_with_junk as $row) {

	$temp = explode('<font size = "2">', $row);
	$temp2 = explode('</font>', $temp[1]);
	
	$array_of_autoresponders[$i]['address'] = $temp2[0];
	
	$temp2 = explode('</font>', $temp[2]);
	
	$array_of_autoresponders[$i]['subject'] = $temp2[0];
	

	$i++;
}


$template->set_filenames(array(
	'body' => $root_path.$template_path.'mail/autoresponders_manage.tpl')
);

$i = 0;
foreach ($array_of_autoresponders as $row) {

	if (!empty($row['address'])) {
		$template->assign_block_vars('autoresponderrow', array(
			'ROWCLASS' => ($i%2) ? $template_cfg['class_row_1'] : $template_cfg['class_row_2'],
			'ADDRESS' => $row['address'],
			'SUBJECT' => $row['subject'],
			
			'U_EDIT' => 'autoresponders_edit.php?email='.$row['address'],
			'U_DELETE' => 'autoresponders_delete_done.php?email='.$row['address'],
			)
		);
	$i++;
	}

}

//
// Stuff to use in the addition of autoresponders
//


// Reading in variables
$s_email = <<<EOFpacman
<cpanel sprint="FORM{'email'},@,0">
EOFpacman;

$s_domains = <<<EOFpacman
<cpanel Email="printdomainoptions($FORM{'email'})">
EOFpacman;

$s_from = <<<EOFpacman
<cpanel Email="getarsfrom(FORM{'email'})">
EOFpacman;

$s_subject = <<<EOFpacman
<cpanel Email="getarssubject(FORM{'email'})">
EOFpacman;

$s_character_format = <<<EOFpacman
<cpanel Email="getarscharset($FORM{'email'})">
EOFpacman;

$s_html_format = <<<EOFpacman
<cpanel Email="getarshtml(FORM{'email'})">
EOFpacman;

$s_body = <<<EOFpacman
<cpanel Email="getarsbody(FORM{'email'})">
EOFpacman;

// And outputting it into template vars.
$template->assign_vars(array(
	'S_ADD_ACTION' => "autoresponders_add_done.php",
	'S_EMAIL' => $s_email,
	'S_DOMAINS' => $s_domains,
	'S_FROM' => $s_from,
	'S_SUBJECT' => $s_subject,
	'S_CHARACTER_FORMAT' => $s_character_format,
	'S_HTML_FORMAT' => $s_html_fromat,
	'S_BODY' => $s_body,
	
	'L_AUTORESPONDERS' => $lang['autoresponders'],
	'L_AUTORESPONDERS_INTRO' => $lang['autoresponders_index'],
	'L_EMAIL' => $lang['email'],
	'L_SUBJECT' => $lang['subject'],
	'L_ACTIONS' => $lang['actions'],
	'L_EDIT' => $lang['edit'],
	'L_DELETE' => $lang['delete'],
	'L_CREATE_AUTORESPONDER' => $lang['create_autoresponder'],
	'L_AUTORESPONDER_EMAIL' => $lang['autoresponder_email'],
	'L_AUTORESPONDER_FROM' => $lang['autoresponder_from'],
	'L_SUBJECT' => $lang['subject'],
	'L_CHARACTER_SET' => $lang['character_set'],
	'L_HTML_MESSAGE' => $lang['html_message'],
	'L_BODY' => $lang['body'],
	'L_AUTORESPONDER_HINTS' => $lang['autoresponder_hints'],
	'L_AUTORESPONDER_HINTS_MESSAGE' => $lang['autoresponder_hints_message'],
));

//
// Woohoo! All done!
//
$template->pparse('body');




include $root_path.'page_tail.php';


?>